package ysq.xyg.base.model.dto;

import lombok.Data;
import lombok.NoArgsConstructor;
import ysq.xyg.base.util.BaseConstant;

/**
 *
 *返回实体类
 *
 * @author shengQiang yu
 * @date 2018-03-18 15:37
 */
@Data
public class ReturnEntity {
    /**
     * 返回状态：1、成功，2、失败
     */
    private int code;
    /**
     * 成功时，返回的参数
     */
    private Object data;
    /**
     * 原因
     */
    private String msg;
    /**
     * 跳转url
     */
    private String url;
    /**
     * 数量
     */
    private long count;
    /**
     * 是否有下一页
     */
    private boolean hasNextPage;

    public ReturnEntity() {
        this.code = BaseConstant.SUCCESS;
        this.msg = BaseConstant.DO_SUCCESS;
    }

    public ReturnEntity(Object data) {
        this.code = BaseConstant.SUCCESS;
        this.data = data;
    }

    public ReturnEntity(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ReturnEntity(int code, Object data, String url) {
        this.code = code;
        this.data = data;
        this.url = url;
    }

    public ReturnEntity(Object data, long count, boolean hasNextPage) {
        this.code = BaseConstant.SUCCESS;
        this.msg=BaseConstant.DO_SUCCESS;
        this.data = data;
        this.count = count;
        this.hasNextPage = hasNextPage;
    }
}
